//go:build ignore
// +build ignore

package main

import (
	"codeup.aliyun.com/5f9118049cffa29cfdd3be1c/util/enttpl"
	"entgo.io/ent/entc"
	"entgo.io/ent/entc/gen"
	"log"
)

func main() {
	opts := []entc.Option{
		//entc.Dependency(
		//	entc.DependencyName("Data"),
		//	entc.DependencyType(&data.Data{}),
		//),
	}
	genConf := &gen.Config{
		Templates: []*gen.Template{
			enttpl.NewTemplate(
				"template/builder/query.tmpl",
				"template/builder/create.tmpl",
				"template/builder/delete.tmpl",
				"template/builder/update.tmpl",
				"template/dialect/sql/query.tmpl",
				"template/dialect/sql/create.tmpl",
				"template/dialect/sql/delete.tmpl",
				"template/dialect/sql/update.tmpl",
				"template/meta.tmpl",
			),
		},
		// --feature intercept,sql/upsert,sql/modifier,sql/lock,sql/execquery ../schema
		Features: []gen.Feature{
			gen.FeatureIntercept,
			gen.FeatureUpsert,
			gen.FeatureModifier,
			gen.FeatureLock,
			gen.FeatureExecQuery,
		},
	}
	if err := entc.Generate("../schema", genConf, opts...); err != nil {
		log.Fatal("running ent codegen:", err)
	}
}
